//
//  MeHomeCell.m
//  OnionHome
//
//  Created by fengjie on 2019/9/14.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "MeHomeCell.h"

@interface MeHomeCell ()
/**图标*/
@property (nonatomic,strong)UIImageView*leftImage;
/**名称*/
@property (nonatomic,strong)UILabel*nameLabel;
@end

@implementation MeHomeCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createUI];
    }
    return self;
}
-(void)createUI{
    [self addSubview:self.leftImage];
    [self addSubview:self.nameLabel];
    
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(16);
        make.width.height.mas_equalTo(20);
    }];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(52);
    }];
}
-(void)setName:(NSString *)name{
    _name = name;
    self.nameLabel.text = name;
}
-(void)setLeftImageName:(NSString *)leftImageName{
    _leftImageName = leftImageName;
    self.leftImage.image = IMAGE_NAMED(leftImageName);
}
#pragma mark --懒加载

-(UIImageView*)leftImage{
    if(!_leftImage){
        _leftImage=[UIImageView new];
//        _leftImage.backgroundColor = UIColor.grayColor;
    }
    return _leftImage;
}
-(UILabel*)nameLabel{
    if(!_nameLabel){
        _nameLabel=[UILabel new];
        _nameLabel.textColor = UIColorFromRGB(0x454F44);
        _nameLabel.font = BOLDSYSTEMFONT(16);
    
    }
    return _nameLabel;
}
@end
